package com.googlecode.bizyap.core.logging;

import org.apache.log4j.Level;

class Log4jLoggerFactory extends LoggerFactory {
	
	protected Logger createLogger(String name) {
		return new Log4jLogger(name);
	}
	
	private class Log4jLogger implements Logger {
		private final org.apache.log4j.Logger logger;
		
		public Log4jLogger(String name) {
			this.logger = org.apache.log4j.Logger.getLogger(name);
		}

		public boolean isDebugEnabled() {
			return logger.isDebugEnabled();
		}

		public boolean isErrorEnabled() {
			return logger.isEnabledFor(Level.ERROR);
		}

		public boolean isInfoEnabled() {
			return logger.isInfoEnabled();
		}

		public boolean isWarnEnabled() {
			return logger.isEnabledFor(Level.WARN);
		}

		public void debug(Object message) {
			logger.debug(message);
		}

		public void debug(Object message, Throwable t) {
			logger.debug(message, t);
		}

		public void info(Object message) {
			logger.info(message);
		}

		public void info(Object message, Throwable t) {
			logger.info(message, t);
		}

		public void warn(Object message) {
			logger.warn(message);
		}

		public void warn(Object message, Throwable t) {
			logger.warn(message, t);
		}

		public void error(Object message) {
			logger.error(message);
		}

		public void error(Object message, Throwable t) {
			logger.error(message, t);
		}
	}
}
